package com.itheima.day07_Collection;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapTest1 {
    public static void main(String[] args) {
        Map<Integer, String> m = new HashMap<>();
        m.put(1, "张三");
        m.put(2, "李四");
        m.put(3, "王五");
        System.out.println(m.size());
        Set<Integer> i = m.keySet();
        for (Integer key : i) {
            String value = m.get(key);
            System.out.println(key + "---" + value);
        }
        System.out.println(m.keySet());
        Set<Map.Entry<Integer, String>> entries = m.entrySet();
        for (Map.Entry<Integer, String> entry : entries) {
            Integer key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "---" + value);
        }
        System.out.println(m.entrySet());
        System.out.println(m.get(1));
        System.out.println(m.get(10));
        System.out.println(m.containsKey(10));
        m.remove(1);
        System.out.println(m);

    }
}
